package com.mywork.activity;


import android.widget.ListView;

import com.ciko.code.adapter.WorkManagerBaodanListAdapter;
import com.ciko.code.base.BaseActicity;
import com.ciko.code.bean.SelRemindPolicyListEty;
import com.ciko.code.http.BaseResponse;
import com.ciko.code.http.HttpClient;
import com.ciko.code.http.Req.SelRemindPolicyListReq;
import com.mywork.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ciko on 2015/12/5.
 */
public class WorkManagerBaodangDateUpDetailActivity extends BaseActicity {

    private ListView lv_baodanWorkManager;

    private WorkManagerBaodanListAdapter workManagerBaodanListAdapter;

    private List<SelRemindPolicyListEty> selPolicyCountListEtyList = new ArrayList<>();
    private ListView lvbaodanWorkManager;

    private int day = 0;

    @Override
    protected void initTopBar() {

        day = getIntent().getIntExtra("DAY", 30);

        setTitle( day + "天内到期的保单");
        enableNavLeftImg();
    }

    @Override
    protected void initLayout() {
        setContentView(R.layout.activity_work_manager_baodang_date_up_detail);
    }

    @Override
    protected void initView() {
        this.lvbaodanWorkManager = (ListView) findViewById(R.id.lv_baodanWorkManager);
    }

    @Override
    protected void initAdapter() {
        workManagerBaodanListAdapter = new WorkManagerBaodanListAdapter(this, selPolicyCountListEtyList, R.layout.item_list_work_manager_baodang_company);
        lvbaodanWorkManager.setAdapter(workManagerBaodanListAdapter);
    }

    @Override
    protected void initDates() {
        HttpClient.getInstance(this).post(new SelRemindPolicyListReq(0,day,0,10), this);
    }

    @Override
    protected void initListener() {

    }

    @Override
    public void onResponseSuccess(BaseResponse<?> response, String tag) {
        super.onResponseSuccess(response, tag);

        List<SelRemindPolicyListEty> selPolicyCountListEtyListResult = (List<SelRemindPolicyListEty>) response.getReturnObject();
        selPolicyCountListEtyList.addAll(selPolicyCountListEtyListResult);
        workManagerBaodanListAdapter.notifyDataSetChanged();

    }
}
